<template>
	<uv-popup ref="popupRef" round="20rpx" :closeOnClickOverlay="false">
		<view class="tip-layout">
			<text class="tip-title">温馨提示</text>
			<text class="tip-content">需同意汇拓宝相关协议，才可正常使用
如不同意将退出应用</text>
			<view class="submit-btn submit-btn-1" @tap="close">再次阅读</view>
			<text class="submit-btn-exit" @tap="exitApp">确认退出</text>
		</view>
	</uv-popup>
</template>

<script setup>
	import { ref } from 'vue'
	const popupRef = ref(null)
	const open = ()=>{
		popupRef.value.open()
	}
	const close = ()=>{
		popupRef.value.close()
	}
	// 退出APP
	const exitApp = ()=>{
		// #ifdef APP-PLUS
		console.log('退出app')
		if (uni.getSystemInfoSync().platform == "ios") {
			// plus.runtime.quit()在ios端无效，需要使用如下方法退出app
			plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
		}
		else{
			plus.runtime.quit()
		}
		// #endif
	}
	defineExpose({
		open
	})
</script>

<style lang="scss" scoped>
.tip-layout{
	width: 560rpx;
	background-color: white;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 40rpx 30rpx;
	.tip-title{
		font-size: 36rpx;
		font-weight: bold;
	}
	.tip-content{
		margin-top: 40rpx;
		text-align: center;
		line-height: 50rpx;
		margin-bottom: 30rpx;
	}
	.submit-btn-1{
		width: 100%;
		margin: 30rpx;
	}
	.submit-btn-exit{
		color: $xh-color-9;
	}
}
</style>